package com.application;

import io.ebean.EbeanServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import javax.servlet.MultipartConfigElement;

@SpringBootApplication
@ComponentScan(nameGenerator = UniqueNameGenerator.class,basePackages={"com.db_tenant","com.imessage","com.bean","com.application"})
@EnableScheduling
@EnableWebMvc
@Slf4j
public class MainApplication {

    @Autowired
    EbeanServer ebeanServer;

    public static void main(String[] args) {
        SpringApplication.run(MainApplication.class, args);
    }





    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //单个文件最大
        factory.setMaxFileSize("10240KB"); //KB,MB
        /// 设置总上传数据总大小
        factory.setMaxRequestSize("102400KB");
        return factory.createMultipartConfig();
    }

}
